www.gusucode.com > 环保时代家庭财务管理系统 EPffms v4.0 > 环保时代家庭财务管理系统 EPffms v4.0\code\eptimehome\tongji\shouzhi.asp

    <!-- #include file="../conn.asp" -->
<!-- #include file="fun.asp" -->
<%
'****************************************************
'Code for EptimeFFMS
'Vision : v3.0
'****************************************************
%>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:*         { behavior: url(#default#VML) }
o\:*         { behavior: url(#default#VML) }
.shape       { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/admin.css" rel="stylesheet" type="text/css">
<style>
body {
	background-color:#FFFFFF;
}
</style>
<style>
TD { FONT-SIZE: 9pt}
</style>
<script language=javascript>
function preview() { 
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->"; 
eprnstr="<!--endprint-->"; 
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml; 
window.print();
window.document.body.innerHTML=bdhtml; 
         }
</script>
</HEAD>

<BODY topmargin=5 leftmargin=0 scroll=AUTO>
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='首页&nbsp;&raquo;&nbsp;报表统计&nbsp;&raquo;&nbsp;收支总表';</script>
<script>
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>

<%  
'取得当前页码
currentpage=request("page")
'response.write currentpage
'response.end
if currentpage<1 or currentpage="" then
  currentpage="1"
end if

'取得搜索关键字
nowstartdate=request("startdate") 
if nowstartdate="" then
  nowstartdate=date()-day(date()-1)
end if
nowenddate=request("enddate") 
if nowenddate="" then
  nowenddate=date()
end if  
nowtype=request("type")
nowEptime_admin=request("Eptime_admin")
nowbigclass=request("bigclass")
nowsmallclass=request("smallclass")
if nowbigclass="" then nowsmallclass=""
nowkeyword=request("keyword")
%>
<table width="95%" border="0" cellpadding="0" cellspacing="0" align="center">
<form name="form2">
  <tr bgcolor="#C4D8ED"> 
    <td width="50" height="30">&nbsp;<img src="../images/print.jpg" align="absmiddle" style="cursor:hand;" onClick="preview();"></td>
	<td width="*" align="right">
	  <select name="type" onChange="form2.submit()">
	    
        <%if nowtype="0" then%><option value="0" selected="selected" readonly="true">收入</option><%end if%>
        <%if nowtype="1" then%><option value="1" selected="selected" readonly="true">支出</option><%end if%>
      </select>
	<%
	sql="select * from Eptime_admin order by id desc"
	set rs_Eptime_admin=conn.execute(sql)
	%>
	  <select name="Eptime_admin" onChange="form2.submit()">
        <option value="">所有成员</option>
        <%
	do while rs_Eptime_admin.eof=false
	%>
        <option value="<%=rs_Eptime_admin("id")%>"<%if trim(cstr(rs_Eptime_admin("id")))=nowEptime_admin then%> selected="selected"<%end if%>><%=rs_Eptime_admin("realname")%></option>
        <%
	  rs_Eptime_admin.movenext
	loop
	%>
      </select>    

    <%
	if nowtype="" then
	  sql="select * from Eptime_money_bigclass order by type,id"
	else
	  sql="select * from Eptime_money_bigclass where type="&nowtype&" order by id"
	end if
	set rs_bigclass=conn.execute(sql)
	%>
	  <select name="bigclass" onChange="form2.submit()">
        <option value="">请选择类别</option>
        <%
	do while rs_bigclass.eof=false
	%>
        <option value="<%=rs_bigclass("id")%>"<%if trim(cstr(rs_bigclass("id")))=nowbigclass then%> selected="selected"<%end if%>><%=rs_bigclass("bigclass")%></option>
        <%
	  rs_bigclass.movenext
	loop
	%>
      </select>
&nbsp;&nbsp;
	</td>
  </tr>
</form>  
</table>
<%
  sql="select * from Eptime_money where 1=1"
  if nowtype<>"" then
	sql=sql&" and type="&nowtype
  end if 
  if nowEptime_admin<>"" then
	sql=sql&" and id_login="&nowEptime_admin
  end if  
  if nowbigclass<>"" then
	sql=sql&" and id_bigclass="&nowbigclass
  end if
  if nowsmallclass<>"" then
	sql=sql&" and id_smallclass="&nowsmallclass
  end If
  
If(databaseType=0) Then 
    if nowstartdate<>"" then
    sql=sql&" and selldate-#"&nowstartdate&"#>=0"
  end if  
  if nowenddate<>"" then
    sql=sql&" and selldate-#"&nowenddate&"#<=0"
  end if
ElseIf(databaseType=1) Then 
  if nowstartdate<>"" then
    sql=sql&" and selldate-'"&nowstartdate&"'>=0"
  end if  
  if nowenddate<>"" then
    sql=sql&" and selldate-'"&nowenddate&"'<=0"
  end if 
End If 





  if nowkeyword<>"" then
	sql=sql&" and (beizhu like '%"&nowkeyword&"%' or id_login in (select id from login where username like '%"&nowkeyword&"%'))"
  end if 
  
  if request("order1")<>"" then
    sql=sql&" order by type "&request("order1")
  elseif request("order2")<>"" then
    sql=sql&" order by id_bigclass "&request("order2")
  elseif request("order3")<>"" then
    sql=sql&" order by id_smallclass "&request("order3") 
  elseif request("order4")<>"" then
    sql=sql&" order by login "&request("order4") 
  elseif request("order5")<>"" then
    sql=sql&" order by selldate "&request("order5") 
  elseif request("order6")<>"" then
    sql=sql&" order by type,price "&request("order6") 
  elseif request("order7")<>"" then
    sql=sql&" order by type desc,price "&request("order7")
  elseif request("order8")<>"" then
    sql=sql&" order by id_login "&request("order8")	       
  else
    sql=sql&" order by id desc"  
  end if
  
set count_buy = server.createobject("ADODB.RecordSet")	
count_buy.open sql,conn,1,3
nowprice1=0
nowprice2=0
do while count_buy.eof=false
  if count_buy("type")=0 then
    nowprice1=nowprice1+count_buy("price")
  else
    nowprice2=nowprice2+count_buy("price")
  end if
  count_buy.movenext
loop
%>

<!--startprint-->
    <%


	if nowbigclass="" then
	  nowbigclass2=0
	else
	  nowbigclass2=nowbigclass 
	end If
	

	sql="select * from Eptime_money_smallclass where id_bigclass="&nowbigclass2&" order by id"


	set rs_smallclass=conn.execute(sql)

dim total(10,2)
n=0
	%>


        <%
	do while rs_smallclass.eof=False
	n=n+1
	%>

        <%
		smallid=rs_smallclass("id")
set count_count = server.createobject("ADODB.RecordSet")

  sql="select * from Eptime_money where id_smallclass="&smallid
  if nowEptime_admin<>"" then
	sql=sql&" and id_login="&nowEptime_admin
  end if 

count_count.open sql,conn,1,3
nowprice3=0
nowprice4=0
do while count_count.eof=false
  if count_count("type")=0 then
    nowprice3=nowprice3+count_count("price")
  else
    nowprice4=nowprice4+count_count("price")
  end if
  count_count.movenext
loop

if nowtype="0" Then 
     If nowprice3="0" Then
     total(n,1)=0
	 else
     total(n,1)=nowprice3
	 End if 
end If
if nowtype="1" Then
     If nowprice4="0" Then
     total(n,1)=0
	 else
     total(n,1)=nowprice4
	 End if
end If

if nowtype="0" Then 
total(n,2)=rs_smallclass("smallclass")+"收入"
end If

if nowtype="1" Then 
total(n,2)=rs_smallclass("smallclass")+"支出"
end If


	  rs_smallclass.movenext
	loop
	%>

  <%
total_no=i
  %>
<br>
<strong>
<%If  nowbigclass<>"" Then%>
      <%If nowEptime_admin="" Then %>【所有成员】的<%Else set rs=conn.execute("select * from Eptime_admin where id="&nowEptime_admin)%>【<%=rs("realname")%>】<%End if%><%set rs=conn.execute("select * from Eptime_money_bigclass where id="&nowbigclass)%><%=rs("bigclass")%>构成图表
</strong>

<%call table1(total,1,80,20,25,700,200,"A")%>	
<%End if%>
<!--endprint-->

</body>
</html>